class Solution
{
public:
    int getLongestPalindrome(string A)
    {
        int LongestPalindrome = 0;
        for (int i = 0; i < A.size(); i++)
        {
            int l = i;
            int r = i;
            while (r < A.size() - 1 && A[r] == A[r + 1])  r++;
            while (l <= r && r < A.size() && A[l] == A[r])
            {
                l--;
                r++;
            }
            LongestPalindrome = max(LongestPalindrome, r - l - 1);
        }
        return LongestPalindrome;
    }
};